﻿using System;
using System.Collections;
using System.Drawing;

namespace CommonUtils
{

    public static class SystemArguments
    {
        public static void Enum()
        {
            //获取所有环境变量
            var variables = (Hashtable)Environment.GetEnvironmentVariables();
            variables.PrintJson();
        }

        /// <summary>
        /// 操作系统
        /// </summary>
        public static readonly OperatingSystem OperatingSystem = Environment.OSVersion;

        /// <summary>
        /// 是否是64位操作系统
        /// </summary>
        public static bool Is64BitOperatingSystem => Environment.Is64BitOperatingSystem;

        /// <summary>
        /// 机器名
        /// </summary>
        public static string MachineName => Environment.MachineName;

        /// <summary>
        /// 主机名
        /// </summary>
        public static string HostName => MachineName;

        /// <summary>
        /// 逻辑磁盘
        /// </summary>
        public static readonly string[] LogicalDrives = Environment.GetLogicalDrives();

        /// <summary>
        /// 系统文件夹
        /// </summary>
        public static readonly string SystemDirectory = Environment.SystemDirectory;

        /// <summary>
        /// 解释环境变量 去掉%%
        /// </summary>
        public static string ExpandVariable(string variable) => Environment.GetEnvironmentVariable(variable);

        /// <summary>
        /// 解释带有环境变量的路径 包含 %SystemRoot% 这种
        /// </summary>
        public static string ExpandVariablePath(string path) => Environment.ExpandEnvironmentVariables(path);

        /// <summary>
        /// 获取特殊文件夹
        /// </summary> 
        public static string GetSpecialFolder(Environment.SpecialFolder specialFolderName) => Environment.GetFolderPath(specialFolderName);

        /// <summary>
        /// 用户域名
        /// </summary>
        public static string UserDomainName => Environment.UserDomainName;

        /// <summary>
        /// 用户名
        /// </summary>
        public static string UserName => Environment.UserName;

        /// <summary>
        /// 用户文件夹
        /// </summary>
        public static readonly string UserFolder = GetSpecialFolder(Environment.SpecialFolder.UserProfile);

        public static readonly string UserDesktopFolder = GetSpecialFolder(Environment.SpecialFolder.Desktop);

        public static readonly string UserDocumentsFolder = GetSpecialFolder(Environment.SpecialFolder.MyDocuments);

        public static readonly string UserVideosFolder = GetSpecialFolder(Environment.SpecialFolder.MyVideos);

        public static readonly string UserDownloadsFolder = UserVideosFolder.Replace("Videos", "Downloads");

        public static readonly Size ScreenSize = new Size(1920, 1080);
    }
}
